﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="ServiceType.aspx.cs" Inherits="ServiceType" %>

<asp:Content ID="Content1" ContentPlaceHolderID="BodyContent" runat="Server">
    <div class="contentfull">
        <div class="breadcrumbs">
            <ul id="crumbs">
                <li><a title="My Account" href="#">My Account</a>
                    <img src="Content/Images/separator.png" alt="&rarr;" class="separator">Buttons</li>
            </ul>
        </div>

        <div id="showMessages"></div>


        <div class="top">
            <div class="innerleft">
                <h1>Edit button &#8220;<%= DisplayServiceName.ToString() %>&#8221; - Step 1</h1>
            </div>
            <ol id="wizard-menu" class="group">
                <li title="Select button type" style="width: 16.50%; float: left">
                    <a href="#" style="width: 100%" class="wizard-step w-active group red" id="step1">
                        <img src="Images/scan48.png" alt="Type">
                        <span class="mobile_disabled">Type</span>
                    </a>
                </li>
                <li title="Name this button." style="width: 16.50%; float: left">
                    <a href="ServiceName.aspx?ServiceId=<%= ServiceId.ToString() %>" style="width: 100%" class="wizard-step w-after group green" id="step2">
                        <img src="Images/service48.png" alt="Name">
                        <span class="mobile_disabled">Name</span>
                    </a>
                </li>
                <li title="Authorize users for this button." style="width: 16.50%; float: left">
                    <a href="ServiceUsers.aspx?ServiceId=<%= ServiceId.ToString() %>" style="width: 100%" class="wizard-step w-after group orange" id="step3">
                        <img src="Images/user48.png" alt="Users">
                        <span class="mobile_disabled">Users</span>
                    </a>
                </li>
                <li title="Ask questions alongside each scan made by this button." style="width: 16.50%; float: left">
                    <a href="ServiceQuestions.aspx?ServiceId=<%= ServiceId.ToString() %>" style="width: 100%" class="wizard-step w-after group gold" id="step4">
                        <img src="Images/question48.png" alt="Questions">
                        <span class="mobile_disabled">Questions</span>
                    </a>
                </li>
                <li title="Modify advanced settings" style="width: 16.50%; float: left">
                    <a href="ServiceAdvanced.aspx?ServiceId=<%= ServiceId.ToString() %>" style="width: 100%" class="wizard-step w-after group blue" id="step5">
                        <img src="Images/optional48.png" alt="Advanced">
                        <span class="mobile_disabled">Advanced</span>
                    </a>
                </li>
                <li title="Done" style="width: 16.50%; float: left">
                    <a href="ServiceDone.aspx?ServiceId=<%= ServiceId.ToString() %>" style="width: 100%" class="wizard-step w-after group purple" id="review">
                        <img src="Images/confirm48.png" alt="Done">
                        <span class="mobile_disabled">Done</span>
                    </a>
                </li>
            </ol>
        </div>
        <div class="content">
            <form method="post" action="ServiceName.aspx?ServiceId=<%= ServiceId.ToString() %>">
                <div class="wizard-nav">
                    <input type="submit" name="login" value="Save and Continue" class="black_button blarge next" style="clear: both;" />
                </div>
                <input type="hidden" name="action" value="editservice2" />
                <input type="hidden" name="serviceid" value="<%= ServiceId.ToString() %>">
                <img src="<%= SrvDetails.ImageIconURL %>" alt="<%= SrvDetails.ServiceType %>" class="left">
                <div class="left indent1">
                    <h2 class="large">Your button type is <strong><%= SrvDetails.ServiceType %></strong>.</h2>
                    <span id="lower_comment_same">This cannot be changed.</span>
                </div>
                <br />
                <br />
                <fieldset style="display:<%= SrvDetails.ServiceSubType=="database" || SrvDetails.ServiceSubType=="ondevicedatabase"?"block":"none" %>">
                    <label>What database would you like to validate your scans against?</label><div class="indent2">
                        <span id="chooseADatabaseSpan">
                            <label for="database" style="display: inline;">Database:</label>
                            <select name="database" id="database" class="selectbox">
                                <%=this.GetDatabaseString() %>
                            </select>
                        </span>
                        <span id="newDatabaseNameInput" style="display: none;">
                            <input type="hidden" class="inputed" id="newDatabaseNameFlag" name="newDatabaseNameFlag" value="0" />
                            <label for="newDatabaseName" style="display: inline;">Enter new database name:</label><br />
                            <input type="text" class="inputed" name="newDatabaseName" />
                        </span>
                        or 
	<a id="newDatabaseNameA1" href="">create a new one</a><a id="newDatabaseNameA2" href="#" style="display: none;">choose among existing</a>.
                    </div>
                    <label>What should be the status of duplicate scans?</label>
                    <div class="divradioset">
                        <input type="radio" name="duplicateValue" id="duplicateValue1" value="1" />
                        <label for="duplicateValue1">Valid</label>
                        <span class="lower_comment">A duplicate scan will have a valid result.</span>
                        <input type="radio" name="duplicateValue" id="duplicateValue0" checked value="0" />
                        <label for="duplicateValue0">Invalid</label>
                        <span class="lower_comment">A duplicate scan will have an invalid result.</span>
                    </div>

                    <%--<label>Would you also like to use a pattern to validate scans not in the database?</label>
                    <div class="divradioset" id="showMaskRadioSet">
                        <input type="checkbox" id="mask" class="showradio" name="enableScanMask">
                        <label for="mask">Apply a Validation Pattern</label>
                        <span class="lower_comment">You can define the pattern using a simple code match, or regular expression.</span>


                        <div class="showdiv">
                            <div id="showMask" style="width: 75%">
                                <div id="showMask2" class="input">

                                    <input type="checkbox" name="regexMask" id="regexMask" value="1">
                                    <label for="regexMask">Use Regular Expression</label>
                                    <br>
                                    <br>

                                    <label for="maskRule" class="normal" id="patternHeader" style="">Code Pattern</label>
                                    <label for="maskRule" class="normal" id="regexHeader" style="display: none;">Regular Expression</label>

                                    <div id="scanMaskInfo" style=''>
                                        <span style="font-size: 11px;">Example:</span><span style="font-family: monospace; padding: 5px;"> 1-800-???-5555</span>
                                        <span class="lower_comment same">Note: The maximum length allowed is 100 characters. Leave pattern blank to match all barcodes.</span>
                                    </div>
                                    <div id="regexMaskInfo" style='display: none;'>
                                        <span style="font-size: 11px;">Example:</span><span style="font-family: monospace; padding: 5px;"> ^([0-9]{5})$</span>
                                        <span class="lower_comment same">Note: <a href="mailto:support@ssica.org?subject=Help%20With%20Custom%20Regular%20Expressions">Contact Us</a> for help with custom regular expressions. </span>
                                    </div>

                                    <input type="text" name="maskRule" id="maskRule" class="word_count largeinput large" value="">
                                    <span class="counter" style=''></span>
                                    <br />

                                    <br />
                                    <label for="maskResponse" class="normal">Response</label>
                                    <textarea name="maskResponse" class="left small" id="maskResponse"></textarea>
                                    <div class="left seven_lg" id="maskOptions">
                                        <input type="checkbox" class="inputcheckbox" name="maskValidity" id="maskValidity" value="1" id="maskValidity">
                                        <label for="maskValidity" class="normal">
                                            <img src="/images/icons/invalid-small.png" alt=""><span>Force an invalid response when a scan match is made.</span></label>
                                        <br />
                                        <br />
                                        <input type="checkbox" class="inputcheckbox" name="maskInsert" id="maskInsert" value="1" id="maskInsert">
                                        <label for="maskInsert" class="normal">
                                            <img src="/images/icons/database16.png" alt=""><span>Add scanned value and response to the database when a match is made.</span></label>
                                    </div>
                                    <br />
                                </div>
                            </div>
                        </div>
                    </div>--%>

                    <script>
                        $(document).ready(function () {
                            activateDivRadioSet($("#showMaskRadioSet"));

                            $("#newDatabaseNameA1, #newDatabaseNameA2").click(function (event) {
                                $("#chooseADatabaseSpan").toggle();
                                $("#newDatabaseNameInput").toggle();
                                $("#newDatabaseNameA1").toggle();
                                $("#newDatabaseNameA2").toggle();
                                $("#newDatabaseNameFlag").attr('value', $("#newDatabaseNameFlag").attr('value') == 1 ? 0 : 1);
                                return false;
                            });


                            $('.word_count').each(function () {
                                var me = this, counter = $(this).parent().find('.counter'),
                                assignLength = (function () {
                                    var l = $(me).val().length;
                                    counter.html('<strong ' + (l > 100 ? 'style="color: red;"' : '') + '>' + l + '</strong> Characters');
                                });
                                assignLength();
                                $(this).keyup(assignLength);
                            });

                            $("#regexMask").click(function (event) {
                                //if ($("#regexMask").is(":checked")) {
                                $("#scanMaskInfo").toggle();
                                $("#regexMaskInfo").toggle();
                                $(".counter").toggle();
                                $("#regexHeader").toggle();
                                $("#patternHeader").toggle();
                                //}
                            });
                        });
                    </script>

                    <input type="submit" name="login" value="Save and Continue" class="black_button blarge right" style="clear: both;" />
                </fieldset>
            </form>
        </div>
    </div>
    <!-- /.contentfull -->
</asp:Content>

